package com.ch.nettyclienttest;

import com.ch.nettyplus.client.channel.ServerChannelHandlerFactory;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

/**
 * @author CH
 * @date 2022/2/24
 */
@Configuration
public class ServerConfig implements InitializingBean {
    @Autowired
    ServerChannelHandlerFactory serverChannelHandlerFactory;

    @Override
    public void afterPropertiesSet(){
        serverChannelHandlerFactory.getServerChannelHandlers().addFirst(new StringDecoder());
        serverChannelHandlerFactory.getServerChannelHandlers().addFirst(new StringEncoder());
    }
}
